package com.zr.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zr.service.UserService;

public class AddValidateUnameController extends HttpServlet{
	UserService userService=new UserService();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(req, resp);
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		String uname=req.getParameter("uname");
		boolean flag=userService.validataUname(uname);
		resp.setCharacterEncoding("utf8");
		//��ȡ�ظ�����ֻ��
		PrintWriter pw=resp.getWriter();
		if(flag){
			pw.write("该用户已存在，请重新输入用户名");
		}else{
			pw.write("没有该用户，可以注册");
			
		}
	}

}
